<?
/**
 * List audit log
 */
(basename($_SERVER['PHP_SELF']) == basename(__FILE__)) && die('Access Denied');

// title
$this->setTitle(WEB_APP_NAME . ' : Audit Log');

// get form object
$dbo = $this->getVar('list');

// what is the id property?
$idProp = $dbo->getIdProperty();

// did search yield results?
$hasResults = (is_array($this->searchResults) and count($this->searchResults));

// Are there errors?
$hasErrors = (is_array($this->getErrors()) and count($this->getErrors()));

// generate sub-menu
$dn  = new menuLink($this->getAppletQs(APPLET_LOG) . '&' . WA_QS_DOWNLOAD . '=yes',
                    'images/download32.png',
                    'Download List');
$sm = new menuBar();
$sm->addToRight($dn);

// generate html
$class = '';
// print css
$this->addCss('css/print.css');
$this->addJs('js/menu.js');
?>
<?= $this->getPageHeader(); ?>
<? if ($hasErrors) { ?>
<div id="container-error">
<?= implode('<br />', $this->getErrors()); ?>
</div>
<? } ?>
<div align="center">
<div id="page-container">

<div id="container-medium">
<?= getMenuBarAdmin(OPT_ADMIN); ?>
<?= $sm->get(); ?>
</div> <!-- container-medium -->

<div id="container-large">
<div class="content-list">
<?= $this->getFormListSearch($dbo); ?>
<table cellpadding="1" cellspacing="1">
<? if ($hasResults) { ?>
<?= $this->getListSortableHeader($dbo); ?>
<? foreach($this->searchResults as &$row) {
	$class = ($class == 'row1') ? 'row2' : 'row1';
?>
	<tr CLASS="<?= $class; ?>">
<? foreach($row as $prop => &$val) {
	if ($prop == $idProp) { continue; }
?>
		<td><?= htmlspecialchars($val); ?></td>
<?	} ?>
	</tr>
<?	} ?>
<? } ?>
</table>
</div> <!-- webapp_list_container -->

<div id="container-pager">
<?= $this->getListPager(); ?>
</div> <!-- container-pager -->
</div> <!-- container-large -->
</div> <!-- page-container -->
</div> <!-- center -->
<script type="text/javascript">
doMenuMsg('System Log');
document.search_form.inputLast.focus();
</script>
<?= $this->getPageFooter(); ?>
